define(function(require) {
	// var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	var Model = function() {
		this.callParent();
	};
	Model.prototype.button1Click = function(event) {
		console.log("button1Click()");
		var data = {};
		data.username = window.app.username;
		data.password = this.comp("PasswordData").getValue("oldPass");
		data.newpwd = this.comp("PasswordData").getValue("newPass");
		data.CtmType= window.app.CtmType;
		console.log(data);
		if (data.password === undefined || data.newpwd === undefined) {
			justep.Util.hint("密码不能为空");
			return;
		}

		var api_url = window.app.base_url + window.app.UserPassWord;
		var self = this;
		$.ajax({
			type : "POST",
			url : require.toUrl(api_url),
			data : {
				'data' : JSON.stringify(data)
			},
			dataType : 'json',
			success : function(res) {
				console.log(res);
				if (res.errno === 1) {
					justep.Util.hint(res.msg);
					self.close();
					return;
				}
				if (res.errno === 3) {
					justep.Util.hint(res.msg);
					return;
				}
			},
			error : function(err) {
				justep.Util.hint("服务器出错，密码修改失败.");
				return;
			}
		});

	};

	Model.prototype.modelParamsReceive = function(event) {
		console.log("modelParamsRecive()");
		console.log(event);
	};

	return Model;
});